package java实验.类关系.ex03;

public class Circle {

    private Point center;
    private double radius;

    public boolean isIntersected(Circle other){
        double pointDistence = other.center.distance(this.center);
        if(this.radius+other.radius<pointDistence){
            return false;
        }else {
            return true;
        }

    }

    public boolean contains(Circle other){
        double pointDistence = other.center.distance(this.center);
        if(this.radius-other.radius>pointDistence){
            return true;
        }else{
            return false;
        }

    }

    public String getCircle(){
        return String.format("[Circle(%d,%d)-%.2f]",this.center.getX(),this.center.getY(),this.radius);
    }

    public double getArea(){
        return Math.PI*this.radius*this.radius;

    }

    public Circle(){
        this.center=new Point();
        this.radius=1.0;
    }

    public Circle(Point center, double radius) {
        this.center = center;
        this.radius = radius;
    }

    public Point getCenter() {
        return center;
    }

    public void setCenter(Point center) {
        this.center = center;
    }

    public double getRadius() {
        return radius;
    }

    public void setRadius(double radius) {
        this.radius = radius;
    }
}